<%@page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
    session = request.getSession();
    if (session.getAttribute("username") == null) {
        response.sendRedirect(request.getContextPath() + "/login.jsp");
    }
%>
<html>
<head>
    <title>主页</title>
</head>
<body>
<h2>欢迎您，${username}~</h2>

<table>
    <tr>
        <th>用户名</th>
        <th>IP地址</th>
        <th>登录时间</th>
    </tr>
    <c:forEach items="${loginLogs}" var="loginLog">
        <tr>
            <td>${loginLog.username}</td>
            <td>${loginLog.ip}</td>
            <td>${loginLog.logintime}</td>
            <td>${dates.format(loginLog.logintime,'yyyy-MM-dd HH:mm:ss')}</td>
        </tr>
    </c:forEach>
</table>
<br/>

</body>
</html>